/*
* created by Administrator on 2018/12/3
* 好的代码像粥一样,是得用时间和精力熬的。
*/
const mongoose =require('mongoose');
const Schema =mongoose.Schema;
const userSchema= new Schema({
    uid: mongoose.Schema.Types.ObjectId,
    username: String,
    gender:Boolean,
    age:Number,
    city:String,
    password: String,
    phoneNumber:String,
});
const articleSchema =new Schema({
    aid: mongoose.Types.ObjectId,
    title:String,
    content:String,
    date:Date,
    author:String,
    favorite: Number,
});
articleSchema.statics.findByUsername=function(username){
   return this.find({username})
};
articleSchema.statics.findByTitle=function(title){
    return this.find({title})
};
module.exports ={
    userSchema,
    articleSchema
};
